<?php
use_stylesheet('list.css');
use_helper('Text');

slot('PageTitle',"Daily Kpi ".$plant);
slot('Title',"Daily Kpi ".$plant);
?>

<div id="showChart">
    
    
    <?php //include_partial("global/sourceDataChart", array("data"=>$srcDatas, "plant"=>$plant))?>

</div>
<div id='showTable'>
    
    <table id="lista"> 
  <thead>
    <tr>
      <th>Date</th>
      <th>Last Update</th>
      <th>SubPlant</th>
      <th>Pr<br>[%]</th>
      <th>Rad<br>[kWh/mq]</th>
      <th>Expen<br>[kWh]</th>
      <th>Tmod<br>[°C]</th>
      <th>Tenv<br>[°C]</th>
    </tr>
  </thead>
  <tbody>
    <?php
       $prevDay="";
       $odd="odd";
      foreach ($PlantKpidays as $kpiday): 
        if ($prevDay!=$kpiday->getDay()){
            $odd = ($odd=="odd")? 'even' : 'odd';
            $prevDay=$kpiday->getDay();
        }
        
        $class="";
        $subplant="Global";
        
        if (strlen($kpiday->getSubPlant())>0){
            //is a subplant
            
            $class="subplant";
            $subplant=$kpiday->getSubplant();
        }
          ?>
   <tr class="<?php echo $odd ?>">
      <td class="<?php echo $class ?>"><?php $day=new DateTime($kpiday->getDay()); echo $day->format("Y-m-d")?></td>
      <td class="<?php echo $class ?>"><?php echo $kpiday->getLastupdate(); ?></td>
      <td class="<?php echo $class ?>"><?php echo $subplant; ?></td>
      <td class="<?php echo $class ?>"><?php echo $kpiday->getPr()*100 ?></td>
      <td class="<?php echo $class ?>"><?php echo $kpiday->getRad() ?></td>
      <td class="<?php echo $class ?>"><?php echo $kpiday->getExpen() ?></td>
      <td class="<?php echo $class ?>"><?php echo $kpiday->getTmod() ?></td>
      <td class="<?php echo $class ?>"><?php echo $kpiday->getTenv() ?></td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
    
</div>


